import { BasicColumn, FormSchema } from '/@/components/Table';
import { commonStatusDict, commonStatusDictMap } from '/@/utils/dict';

export const columns: BasicColumn[] = [
  {
    title: '租户名称',
    dataIndex: 'name',
  },
  {
    title: '租户编码',
    dataIndex: 'code',
  },
  {
    title: '联系人',
    dataIndex: 'contactName',
  },
  {
    title: '过期时间',
    dataIndex: 'expiredTime',
  },
  {
    title: '状态',
    dataIndex: 'status',
    dictFormat: commonStatusDictMap,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'name',
    label: '租户名称',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'code',
    label: '租户编码',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'status',
    label: '状态',
    component: 'Select',
    componentProps: {
      options: commonStatusDict,
    },
    colProps: { span: 6 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: 'ID',
    component: 'Input',
    show: false,
  },
  {
    label: '基本信息',
    field: 'baseInfo',
    component: 'Divider',
    colProps: { lg: 24, md: 24 },
  },
  {
    field: 'name',
    label: '租户名称',
    component: 'Input',
    required: true,
  },
  {
    field: 'code',
    label: '租户编码',
    component: 'Input',
    required: true,
  },
  {
    field: 'packageId',
    label: '开通套餐',
    component: 'Select',
    slot: 'packageSlot',
    defaultValue: [],
    required: true,
  },
  {
    field: 'status',
    label: '状态',
    component: 'RadioButtonGroup',
    defaultValue: 1,
    componentProps: {
      options: commonStatusDict,
    },
    required: true,
  },
  {
    label: '联系方式',
    field: 'contact',
    component: 'Divider',
    colProps: { lg: 24, md: 24 },
  },
  {
    field: 'contactName',
    label: '联系人',
    component: 'Input',
    required: true,
  },
  {
    field: 'mobile',
    label: '联系电话',
    component: 'Input',
  },
  {
    field: 'email',
    label: '联系邮箱',
    component: 'Input',
  },
  {
    field: 'address',
    label: '联系地址',
    component: 'Input',
  },
  {
    label: '其他',
    field: 'other',
    component: 'Divider',
    colProps: { lg: 24, md: 24 },
  },
  {
    field: 'expiredTime',
    label: '过期时间',
    component: 'Input',
  },
  {
    field: 'licenseKey',
    label: '授权码',
    component: 'Input',
  },
  {
    field: 'domainName',
    label: '绑定域名',
    component: 'Input',
  },
  {
    field: 'backgroundImage',
    label: '背景图片',
    component: 'Input',
  },
  {
    field: 'remark',
    label: '备注',
    component: 'InputTextArea',
    colProps: { lg: 24, md: 24 },
  },
];
